#ifndef __RUI_DICTIONARY_HPP__
#define __RUI_DICTIONARY_HPP__
#include <vector>
#include <map>
#include <set>
#include <string>

using std::vector;
using std::map;
using std::set;
using std::pair;
using std::string;


namespace wd{
class Dictionary{
public:
    static Dictionary* getInstance();
    static void destory();
    void init(const string &dicpath = "/home/hcg/CPP2/SE_v2/data/dict.dat", const string &indexpath = "/home/hcg/CPP2/SE_v2/data/dictIndex.dat");
    std::vector<std::pair<string, int>>& getDict();
    std::map<string, std::set<int>>& getIndexTable();
   // string doQuery(const string& word);
    
    static Dictionary* getDictptr(){
        return _dicttionary;
    }
    
private:
    Dictionary(){}
    ~Dictionary(){}
private:
    std::vector<std::pair<string, int>> _dict;
    std::map<string, std::set<int>> _indexTable;
    static Dictionary *_dicttionary;
};

}


#endif
